import JSEncrypt from "jsencrypt";

const publicKey = '';
const privateKey = '';

/**
 * 加密
 * @param {*} txt 
 * @returns 
 */
export function encrypt(txt) {
    let encryptor = new JSEncrypt()
    encryptor.setPublicKey(publicKey);
    return encryptor.encrypt(txt);
}

/**
 * 解密
 * @param {*} txt 
 * @returns 
 */
export function decrypt(txt) {
    let decryptor = new JSEncrypt()
    decryptor.setPrivateKey(privateKey);
    return decryptor.decrypt(txt);
}